package com.wzk.travelspringboot.dto;

import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author: WangZiKang
 * @Date: 2025/1/4 22:12
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result <T> {

    private Integer code;

    private String message;

    private T data;

    private static final Integer SUCCESS_CODE = 200;

    public static <T> Result success(T data){
        return new Result(SUCCESS_CODE,"success",data);
    }

    public static Result success(String message){
        return new Result(SUCCESS_CODE,message,null);
    }


    public static <T> Result success(String message,T data){
        return new Result(SUCCESS_CODE,message,data);
    }

    public static Result failed(){
        return new Result(0,"failed",null);
    }

    public static Result failed(String message){
        return new Result(0,message,null);
    }


}
